#ifndef BUTTON_HOME_PUT_H
#define BUTTON_HOME_PUT_H

#include "button_cust_base.h"
#include <QPushButton>
#include <QMouseEvent>

#include <QEvent>
#include <QPixmap>
#include <QIcon>

//自定义控件  智能家居 开关按钮

class button_home_put : public Button_Cust_Base
{
    Q_OBJECT


public:
    explicit button_home_put(QWidget *parent = nullptr);

    QPixmap onEnterImage = QPixmap(":/ison_is.png");
    QPixmap onPressImage = QPixmap(":/ison_isin.png");
    QPixmap onLeaveImage = QPixmap(":/ison_on.png");
    //关
    QPixmap offEnterImage = QPixmap(":/ison_on.png");
    //关点击事件
    QPixmap offPressImage = QPixmap(":/ison_onin.png");
    //关默认事件
    QPixmap offLeaveImage = QPixmap(":/ison_is.png");
    //初始状态

    bool isOn;

protected:
    // 进入事件
    void enterEvent(QEvent *event);

    // 离开事件
    void leaveEvent(QEvent *event);

    // 按下事件
    void mousePressEvent(QMouseEvent *event);

    // 释放事件
    void mouseReleaseEvent(QMouseEvent *event);

signals:
    void stateChanged(bool isOn);

private:

    void updateImage();



};

#endif // BUTTON_HOME_PUT_H
